package com.yqg.education.mapper;

import com.yqg.education.entity.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 张芸博
 * @since 2025-04-10
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course> {

    List<Course> findPage(Integer pageNum, Integer pageSize, String name, Integer typeId);

    Long findCount(String name, Integer typeId);

    List<Course> findStuPage(@Param("pageStartNumber") Integer pageStartNumber, @Param("pageSize") Integer pageSize, @Param("name") String name, @Param("typeId") Integer typeId, @Param("courseId") List<Long> courseId);

    Long findStuCount(@Param("name") String name, @Param("typeId") Integer typeId, @Param("courseId") List<Long> courseId);

    List<Course> findPageByClassId(Integer pageNum, Integer pageSize, String name, Integer typeId, Integer classId);

    Long findCountByClassId(String name, Integer typeId, Integer classId);

    Long getCourseCount();

    @Select("select * from course where ")
    List<Course> getCourseByClassId(Long classId);

    /**
     * 通过班级ID查找未绑定的所有课程
     * @param classId 班级ID
     * @return 未绑定的所有课程
     */
    List<Course> getAllUnboundCourseByClass(@Param("classId") Long classId);
}
